package com.tuocent.dagv2.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.tuocent.dagv2.entity.Modules;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;


/**
 * <p>
 * 模块信息表 Mapper 接口
 * </p>
 *
 * @author Vincent
 * @since 2025-07-22
 */
@Mapper
public interface ModulesMapper extends BaseMapper<Modules> {
    String sql = "select b.id, b.pid, b.model, b.isshow, b.modulename, b.title, b.route, " +
            "b.imgidx, b.isnav from sys_role_permission as a left join " +
            "sys_modules as b on a.moduleid=b.id and isshow=1 ${ew.customSqlSegment}";

    @Select(sql)
    List<Modules> userModule(@Param("ew") Wrapper<Modules> queryWrapper);

    String lnkSortSql = "select b.* from sys_role_permission as a , sys_modules as b  ${ew.customSqlSegment}";

    @Select(lnkSortSql)
    List<Modules> useLnkSortModule(@Param("ew") Wrapper<Modules> queryWrapper);
}

